﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SuperSocket.SocketBase;
using SuperSocket.WebSocket;
using System.Collections.Concurrent;

namespace SocketData
{
    class MyWS: WebSocketServer
    {
        //反射控制器
        public ControllerRunner CtrlRunner = new ControllerRunner("XBJCYGC");
        //房间-》sessionid的字典
        public ConcurrentDictionary<string,HashSet<string>> RoomDiction= new ConcurrentDictionary<string, HashSet<string>>();

        protected override void OnSessionClosed(WebSocketSession session, CloseReason reason)
        {
            foreach (var item in RoomDiction)
            {
                if (item.Value.Contains(session.SessionID))
                {
                    item.Value.Remove(session.SessionID);
                }
            }
            base.OnSessionClosed(session, reason);
        }
    }


}
